package cn.org.redis.service;

import cn.org.redis.bean.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;



/**
 * @ClassName RedisService
 * @Author swj
 * @Date 2020/9/29 14:10
 */
@Service
public class RedisService {

    private Logger logger = LoggerFactory.getLogger(RedisService.class);

    @Autowired
    private RedisTemplate<String,Object> redisTemplate;

    public void setString(){
        User user = new User();
        user.setPassword("123");
        user.setUsername("swj");
        redisTemplate.opsForValue().set("mystringkey",user);
        User ss = (User) redisTemplate.opsForValue().get("mystringkey");
        logger.info("String测试:{}",ss.toString());
    }
    public void setList(){

    }


}
